package com.atguigu.bigdata.scala.mytest.chapter07

import scala.collection.mutable
import scala.collection.mutable.ListBuffer

object Test_ListBuffer {
  def main(args: Array[String]): Unit = {
    val ints: ListBuffer[Int] = ListBuffer(1,2,3)

    ints.append(9)
    println(ints)

    ints.insert(0,111)
    println(ints)

    ints.remove(3)
    println(ints)

    ints.update(0,222)
    println(ints)

    ints.foreach(s=>{println(s)})

    val list: List[Int] = ints.toList
    println(list)

    val buffer: mutable.Buffer[Int] = list.toBuffer
    println(buffer)

    // 空集合List()
    val ints1: List[Int] = 3:: 2::1::List()
    println(ints1)

    // 空集合对象 ： Nil
    val ints2: List[Int] = 3:: 2::1::Nil
    println(ints2)
  }

}
